<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
  <style>
     p{
	    font-size:20px;
	 }
  </style>
  <script src="jQuery复习/jquery-3.3.1.js"></script>
 </head>
 <body>
    <div>
	   <p>11111111111</p>
	   <p>22222222222</p>
	   <p>33333333333</p>
	</div>
	<div>
	  <p>4444444444</p>
	</div>
 </body>
 <script>
    //匹配div中的第一个子元素p
    $("div p:first-child").css({"color":"red"});
	//匹配div中的最后一个子元素p
	$("div p:last-child").css({"color":"yellow"});
	//匹配div中的第2个子元素p
	$("div p:nth-child(2)").css({"color":"blue"});
	//匹配div中只有一个子元素的元素p
	$("div p:only-child").css({"color":"blue"});
 </script>
</html>
